#include "Reader.h"
#include "Tokenizer.h"
#include "Scuba.h"
#include "ScopePrinter.h"

#include <string>
#include <iostream>
#include <conio.h>

std::string gsFileName = "./test.c";

Reader xReader;
Tokenizer xTokenizer;
Scuba xScubaDiver;
ScopePrinter xScopePrinter;

using namespace std;

int main(int argc, char**argv)
{
    bool bInIDE = true;
    if(argc==2)
        {
        bInIDE = false;
        gsFileName=argv[1];
        }

    cerr<<endl<<gsFileName<<",";
    xReader.gobble(gsFileName);

    xTokenizer.tokenize(xReader.getStream());

    xScubaDiver.setObserver(&xScopePrinter);

    int nListSize;
    nListSize = (int)xTokenizer.m_asTokens.size();
    for(int nLooper = 0; nLooper<nListSize; nLooper++)
    {
        xScubaDiver.feed(xTokenizer.m_asTokens[nLooper]);
    }

    cerr<<"...Done!";
    if(bInIDE)
        _getch();
    return 0;
}


